Daniel Bannert's open source work is supported by the community on GitHub Sponsors
Install
npm install @visulima/package
yarn add @visulima/package
pnpm add @visulima/package
Usage
findMonorepoRoot
Find the root directory path and strategy for a monorepo based on the given current working directory (cwd).
import { findMonorepoRoot } from "@visulima/package";
const root = findMonorepoRoot();
findPackageRoot
Find the root directory path and strategy for a package based on the given current working directory (cwd).
import { findPackageRoot } from "@visulima/package";
const root = findPackageRoot();
findPackageJson
Find the package.json file in the specified directory or its parent directories.
import { findPackageJson } from "@visulima/package";
const root = findPackageJson();
writePackageJson
Writes the package.json file with the given data.
import { writePackageJson } from "@visulima/package";
writePackageJson({ name: "visulima" } );
parsePackageJson
Parse the package.json file.
import { parsePackageJson } from "@visulima/package";
const packageJson = parsePackageJson();
findLockFile
Asynchronously finds a lock file in the specified directory or any of its parent directories.
import { findLockFile } from "@visulima/package";
const lockFile = await findLockFile();
findPackageManager
Finds the package manager used in a project based on the presence of lock files or package.json configuration.
If found, returns the package manager and the path to the lock file or package.json.
Throws an error if no lock file or package.json is found.
import { findPackageManager } from "@visulima/package";
const { packageManager, path } = findPackageManager();
getPackageManagerVersion
Retrieves the version of the specified package manager.
import { getPackageManagerVersion } from "@visulima/package";
const version = await getPackageManagerVersion("npm");
Supported Node.js Versions
Libraries in this ecosystem make the best effort to track Node.js’ release schedule.
Here’s a post on why we think this is important.
Contributing
If you would like to help take a look at the list of issues and check our Contributing guild.
Note: please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Credits
About
Related Projects
License
The visulima package is open-sourced software licensed under the MIT